from fastapi import APIRouter,Request

app7 = APIRouter()

@app7.get('/books')
async def books(request:Request):
    return {
        '请求URL':request.url,
        '请求IP':request.client.host,
        '请求宿主机':request.headers.get('User-Agent'),
        'cookie':request.cookies
    }